package vip.xiaonuo.bi.modular.datasource.service.impl;

import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import vip.xiaonuo.bi.modular.datasource.entity.DatasourceType;
import vip.xiaonuo.bi.modular.datasource.mapper.DatasourceTypeMapper;
import vip.xiaonuo.bi.modular.datasource.service.DatasourceTypeService;

import java.util.List;

/**
 * 数据源分类表Service接口实现类
 *
 * @author 顾育司
 * @date  2023/12/15 12:09
 **/
@Service
public class DatasourceTypeServiceImpl extends ServiceImpl<DatasourceTypeMapper, DatasourceType> implements DatasourceTypeService {


    @Override
    public List<DatasourceType> getlist(String classifyId, String datasourceName) {
        QueryWrapper<DatasourceType> queryWrapper = new QueryWrapper<>();
        if(ObjectUtil.isNotEmpty(classifyId)) {
            queryWrapper.lambda().eq(DatasourceType::getDataClassifyId, classifyId);
        }
        if(ObjectUtil.isNotEmpty(datasourceName)) {
            queryWrapper.lambda().like(DatasourceType::getDataClassifyId, classifyId);
        }
        return this.list(queryWrapper);
    }
}